USE [aircond]
GO

/****** Object:  Table [dbo].[MACHINE]    Script Date: 03/15/2013 00:04:35 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MACHINE](
	[MACHINE_ID] [numeric](19, 0) IDENTITY(1,1) NOT NULL,
	[createDate] [datetime] NULL,
	[createUser] [varchar](255) NULL,
	[updateDate] [datetime] NULL,
	[updateUser] [varchar](255) NULL,
	[version] [int] NOT NULL,
	[deviceNo] [int] NOT NULL,
	[gateNo] [int] NOT NULL,
	[height] [int] NOT NULL,
	[intv] [int] NOT NULL,
	[isCold] [char](1) NOT NULL,
	[isShow] [char](1) NOT NULL,
	[machineName] [varchar](255) NULL,
	[machineType] [varchar](255) NULL,
	[mainNumber] [int] NOT NULL,
	[posX] [int] NOT NULL,
	[posY] [int] NOT NULL,
	[status] [varchar](255) NULL,
	[subNumber] [int] NOT NULL,
	[width] [int] NOT NULL,
	[ROOM_ID] [numeric](19, 0) NULL,
PRIMARY KEY CLUSTERED 
(
	[MACHINE_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
UNIQUE NONCLUSTERED 
(
	[gateNo] ASC,
	[deviceNo] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[MACHINE]  WITH CHECK ADD  CONSTRAINT [FK5BFCD027894354C7] FOREIGN KEY([ROOM_ID])
REFERENCES [dbo].[ROOM] ([ROOM_ID])
GO

ALTER TABLE [dbo].[MACHINE] CHECK CONSTRAINT [FK5BFCD027894354C7]
GO

